import request from '@/config/axios'
import type { Dayjs } from 'dayjs'

/** 联系平台信息 */
export interface ContactPlatform {
  id: number // id
  phone: string // 联系电话
  updateTime?: Dayjs | string // 更新时间
}

// 联系平台 API
export const ContactPlatformApi = {
  // 查询联系平台分页
  getContactPlatformPage: async (params: any) => {
    return await request.get({ url: `/biz/contact-platform/page`, params })
  },

  // 查询联系平台详情
  getContactPlatform: async (id: number) => {
    return await request.get({ url: `/biz/contact-platform/get?id=` + id })
  },

  // 新增联系平台
  createContactPlatform: async (data: ContactPlatform) => {
    return await request.post({ url: `/biz/contact-platform/create`, data })
  },

  // 修改联系平台
  updateContactPlatform: async (data: ContactPlatform) => {
    return await request.put({ url: `/biz/contact-platform/update`, data })
  },

  // 删除联系平台
  deleteContactPlatform: async (id: number) => {
    return await request.delete({ url: `/biz/contact-platform/delete?id=` + id })
  },

  /** 批量删除联系平台 */
  deleteContactPlatformList: async (ids: number[]) => {
    return await request.delete({ url: `/biz/contact-platform/delete-list?ids=${ids.join(',')}` })
  },

  // 导出联系平台 Excel
  exportContactPlatform: async (params) => {
    return await request.download({ url: `/biz/contact-platform/export-excel`, params })
  }
}
